home *** CD-ROM | disk | FTP | other *** search
- package
- {
- import caurina.transitions.*;
- import fl.controls.Button;
- import flash.display.MovieClip;
- import flash.display.Sprite;
- import flash.events.*;
- import flash.geom.*;
- import flash.printing.*;
- import flash.text.TextField;
-
- public class TweenerTransitionCheatSheet extends Sprite
- {
- public static const MARGIN_HORIZONTAL:Number = 14;
-
- public static const MARGIN_VERTICAL:Number = 10;
-
- public static const MARGIN_LEFT:Number = 12;
-
- public static const MARGIN_RIGHT:Number = 12;
-
- public static const MARGIN_TOP:Number = 40;
-
- public static const MARGIN_BOTTOM:Number = 34;
-
- public var messageBottom:TextField;
-
- public var barBottom:MovieClip;
-
- public var barTop:MovieClip;
-
- private var _firstLineHidden:Boolean;
-
- public var bPrint:Button;
-
- public var bHideFirstLine:Button;
-
- private var _currentDrawMode:uint;
-
- public var descriptionMessage:DescriptionMessage;
-
- private var _falseScaleX:Number = 1;
-
- private var _falseScaleY:Number = 1;
-
- public var bMode1:Button;
-
- public var bMode0:Button;
-
- public var bMode2:Button;
-
- private var _transitionTypes:Array;
-
- public function TweenerTransitionCheatSheet()
- {
- _falseScaleX = 1;
- _falseScaleY = 1;
- super();
- stage.scaleMode = "noScale";
- stage.align = "LT";
- _transitionTypes = new Array();
- _transitionTypes.push({
- "name":"linear",
- "equation":Equations.easeNone,
- "lineFeed":true,
- "drawMode":0
- });
- _transitionTypes.push({
- "name":"easeInSine",
- "equation":Equations.easeInSine,
- "drawMode":0
- });
- _transitionTypes.push({
- "name":"easeOutSine",
- "equation":Equations.easeOutSine,
- "drawMode":0
- });
- _transitionTypes.push({
- "name":"easeInOutSine",
- "equation":Equations.easeInOutSine,
- "drawMode":1
- });
- _transitionTypes.push({
- "name":"easeOutInSine",
- "equation":Equations.easeOutInSine,
- "drawMode":2
- });
- _transitionTypes.push({
- "name":"easeInQuad",
- "equation":Equations.easeInQuad,
- "drawMode":0
- });
- _transitionTypes.push({
- "name":"easeOutQuad",
- "equation":Equations.easeOutQuad,
- "drawMode":0
- });
- _transitionTypes.push({
- "name":"easeInOutQuad",
- "equation":Equations.easeInOutQuad,
- "drawMode":1
- });
- _transitionTypes.push({
- "name":"easeOutInQuad",
- "equation":Equations.easeOutInQuad,
- "drawMode":2
- });
- _transitionTypes.push({
- "name":"easeInCubic",
- "equation":Equations.easeInCubic,
- "drawMode":0
- });
- _transitionTypes.push({
- "name":"easeOutCubic",
- "equation":Equations.easeOutCubic,
- "drawMode":0
- });
- _transitionTypes.push({
- "name":"easeInOutCubic",
- "equation":Equations.easeInOutCubic,
- "drawMode":1
- });
- _transitionTypes.push({
- "name":"easeOutInCubic",
- "equation":Equations.easeOutInCubic,
- "drawMode":2
- });
- _transitionTypes.push({
- "name":"easeInQuart",
- "equation":Equations.easeInQuart,
- "drawMode":0
- });
- _transitionTypes.push({
- "name":"easeOutQuart",
- "equation":Equations.easeOutQuart,
- "drawMode":0
- });
- _transitionTypes.push({
- "name":"easeInOutQuart",
- "equation":Equations.easeInOutQuart,
- "drawMode":1
- });
- _transitionTypes.push({
- "name":"easeOutInQuart",
- "equation":Equations.easeOutInQuart,
- "drawMode":2
- });
- _transitionTypes.push({
- "name":"easeInQuint",
- "equation":Equations.easeInQuint,
- "drawMode":0
- });
- _transitionTypes.push({
- "name":"easeOutQuint",
- "equation":Equations.easeOutQuint,
- "drawMode":0
- });
- _transitionTypes.push({
- "name":"easeInOutQuint",
- "equation":Equations.easeInOutQuint,
- "drawMode":1
- });
- _transitionTypes.push({
- "name":"easeOutInQuint",
- "equation":Equations.easeOutInQuint,
- "drawMode":2
- });
- _transitionTypes.push({
- "name":"easeInExpo",
- "equation":Equations.easeInExpo,
- "drawMode":0
- });
- _transitionTypes.push({
- "name":"easeOutExpo",
- "equation":Equations.easeOutExpo,
- "drawMode":0
- });
- _transitionTypes.push({
- "name":"easeInOutExpo",
- "equation":Equations.easeInOutExpo,
- "drawMode":1
- });
- _transitionTypes.push({
- "name":"easeOutInExpo",
- "equation":Equations.easeOutInExpo,
- "drawMode":2
- });
- _transitionTypes.push({
- "name":"easeInCirc",
- "equation":Equations.easeInCirc,
- "drawMode":0
- });
- _transitionTypes.push({
- "name":"easeOutCirc",
- "equation":Equations.easeOutCirc,
- "drawMode":0
- });
- _transitionTypes.push({
- "name":"easeInOutCirc",
- "equation":Equations.easeInOutCirc,
- "drawMode":1
- });
- _transitionTypes.push({
- "name":"easeOutInCirc",
- "equation":Equations.easeOutInCirc,
- "drawMode":2
- });
- _transitionTypes.push({
- "name":"easeInElastic",
- "equation":Equations.easeInElastic,
- "drawMode":0
- });
- _transitionTypes.push({
- "name":"easeOutElastic",
- "equation":Equations.easeOutElastic,
- "drawMode":0
- });
- _transitionTypes.push({
- "name":"easeInOutElastic",
- "equation":Equations.easeInOutElastic,
- "drawMode":1
- });
- _transitionTypes.push({
- "name":"easeOutInElastic",
- "equation":Equations.easeOutInElastic,
- "drawMode":2
- });
- _transitionTypes.push({
- "name":"easeInBack",
- "equation":Equations.easeInBack,
- "drawMode":0
- });
- _transitionTypes.push({
- "name":"easeOutBack",
- "equation":Equations.easeOutBack,
- "drawMode":0
- });
- _transitionTypes.push({
- "name":"easeInOutBack",
- "equation":Equations.easeInOutBack,
- "drawMode":1
- });
- _transitionTypes.push({
- "name":"easeOutInBack",
- "equation":Equations.easeOutInBack,
- "drawMode":2
- });
- _transitionTypes.push({
- "name":"easeInBounce",
- "equation":Equations.easeInBounce,
- "drawMode":0
- });
- _transitionTypes.push({
- "name":"easeOutBounce",
- "equation":Equations.easeOutBounce,
- "drawMode":0
- });
- _transitionTypes.push({
- "name":"easeInOutBounce",
- "equation":Equations.easeInOutBounce,
- "drawMode":1
- });
- _transitionTypes.push({
- "name":"easeOutInBounce",
- "equation":Equations.easeOutInBounce,
- "drawMode":2
- });
- setupTransitionGrid();
- bMode0.addEventListener(MouseEvent.CLICK,onClickMode0);
- bMode1.addEventListener(MouseEvent.CLICK,onClickMode1);
- bMode2.addEventListener(MouseEvent.CLICK,onClickMode2);
- bHideFirstLine.addEventListener(MouseEvent.CLICK,toggleFirstLine);
- bPrint.addEventListener(MouseEvent.CLICK,printSheet);
- addEventListener(Event.ENTER_FRAME,repaintModeButtons);
- stage.addEventListener(Event.RESIZE,onResize);
- currentDrawMode = 1;
- _firstLineHidden = false;
- onResize();
- __setProp_bMode2_Scene1_buttons_1();
- __setProp_bMode1_Scene1_buttons_1();
- __setProp_bPrint_Scene1_buttons_1();
- __setProp_bMode0_Scene1_buttons_1();
- __setProp_bHideFirstLine_Scene1_buttons_1();
- }
-
- public function set firstLineHidden(param1:Boolean) : void
- {
- _firstLineHidden = param1;
- redrawAll();
- }
-
- public function redrawAll() : void
- {
- barTop.width = barBottom.width = windowWidth;
- barBottom.y = windowHeight - barBottom.height;
- messageBottom.x = windowWidth / 2 - messageBottom.width / 2;
- messageBottom.y = barBottom.y + barBottom.height / 2 - messageBottom.height / 2;
- redrawButtons();
- redrawGrid();
- }
-
- public function get windowHeight() : Number
- {
- return stage.stageHeight * _falseScaleY;
- }
-
- internal function __setProp_bHideFirstLine_Scene1_buttons_1() : *
- {
- try
- {
- bHideFirstLine["componentInspectorSetting"] = true;
- }
- catch(e:Error)
- {
- }
- bHideFirstLine.emphasized = false;
- bHideFirstLine.enabled = true;
- bHideFirstLine.label = "Hide first line";
- bHideFirstLine.labelPlacement = "right";
- bHideFirstLine.selected = false;
- bHideFirstLine.toggle = true;
- bHideFirstLine.visible = true;
- try
- {
- bHideFirstLine["componentInspectorSetting"] = false;
- }
- catch(e:Error)
- {
- }
- }
-
- public function setupTransitionGrid() : void
- {
- var _loc1_:TransitionGraphic = null;
- var _loc2_:uint = 0;
- _loc2_ = 0;
- while(_loc2_ < _transitionTypes.length)
- {
- _loc1_ = new TransitionGraphic(_transitionTypes[_loc2_].name,_transitionTypes[_loc2_].equation);
- addChild(_loc1_);
- _loc1_.showTransition(_loc2_ * 0.1);
- _transitionTypes[_loc2_].container = _loc1_;
- _loc2_++;
- }
- }
-
- public function repaintModeButtons(param1:Event = null) : void
- {
- currentDrawMode = _currentDrawMode;
- removeEventListener(Event.ENTER_FRAME,repaintModeButtons);
- }
-
- internal function __setProp_bMode0_Scene1_buttons_1() : *
- {
- try
- {
- bMode0["componentInspectorSetting"] = true;
- }
- catch(e:Error)
- {
- }
- bMode0.emphasized = false;
- bMode0.enabled = true;
- bMode0.label = "Simple";
- bMode0.labelPlacement = "right";
- bMode0.selected = false;
- bMode0.toggle = false;
- bMode0.visible = true;
- try
- {
- bMode0["componentInspectorSetting"] = false;
- }
- catch(e:Error)
- {
- }
- }
-
- public function onResize(param1:Event = null) : void
- {
- redrawAll();
- }
-
- public function redrawButtons() : void
- {
- var _loc1_:Number = NaN;
- var _loc2_:Number = NaN;
- bMode0.enabled = _currentDrawMode != 0;
- bMode1.enabled = _currentDrawMode != 1;
- bMode2.enabled = _currentDrawMode != 2;
- _loc1_ = 10;
- _loc2_ = windowWidth - _loc1_;
- _loc2_ -= bPrint.width;
- bPrint.x = _loc2_;
- _loc2_ -= _loc1_;
- _loc2_ -= bHideFirstLine.width;
- bHideFirstLine.x = _loc2_;
- _loc2_ -= _loc1_;
- _loc2_ -= bMode2.width;
- bMode2.x = _loc2_;
- _loc2_ -= bMode1.width - 1;
- bMode1.x = _loc2_;
- _loc2_ -= bMode0.width - 1;
- bMode0.x = _loc2_;
- }
-
- internal function __setProp_bMode2_Scene1_buttons_1() : *
- {
- try
- {
- bMode2["componentInspectorSetting"] = true;
- }
- catch(e:Error)
- {
- }
- bMode2.emphasized = false;
- bMode2.enabled = true;
- bMode2.label = "Complete";
- bMode2.labelPlacement = "right";
- bMode2.selected = false;
- bMode2.toggle = false;
- bMode2.visible = true;
- try
- {
- bMode2["componentInspectorSetting"] = false;
- }
- catch(e:Error)
- {
- }
- }
-
- public function onClickMode2(param1:Event = null) : void
- {
- currentDrawMode = 2;
- }
-
- public function onClickMode1(param1:Event = null) : void
- {
- currentDrawMode = 1;
- }
-
- internal function __setProp_bMode1_Scene1_buttons_1() : *
- {
- try
- {
- bMode1["componentInspectorSetting"] = true;
- }
- catch(e:Error)
- {
- }
- bMode1.emphasized = false;
- bMode1.enabled = true;
- bMode1.label = "Medium";
- bMode1.labelPlacement = "right";
- bMode1.selected = false;
- bMode1.toggle = false;
- bMode1.visible = true;
- try
- {
- bMode1["componentInspectorSetting"] = false;
- }
- catch(e:Error)
- {
- }
- }
-
- public function onClickMode0(param1:Event = null) : void
- {
- currentDrawMode = 0;
- }
-
- public function get currentDrawMode() : Number
- {
- return _currentDrawMode;
- }
-
- public function get firstLineHidden() : Boolean
- {
- return _firstLineHidden;
- }
-
- public function set currentDrawMode(param1:Number) : void
- {
- _currentDrawMode = param1;
- redrawAll();
- }
-
- internal function __setProp_bPrint_Scene1_buttons_1() : *
- {
- try
- {
- bPrint["componentInspectorSetting"] = true;
- }
- catch(e:Error)
- {
- }
- bPrint.emphasized = false;
- bPrint.enabled = true;
- bPrint.label = "Print";
- bPrint.labelPlacement = "right";
- bPrint.selected = false;
- bPrint.toggle = false;
- bPrint.visible = true;
- try
- {
- bPrint["componentInspectorSetting"] = false;
- }
- catch(e:Error)
- {
- }
- }
-
- public function printSheet(param1:Event = null) : void
- {
- var _loc2_:PrintJob = null;
- var _loc3_:Rectangle = null;
- _loc2_ = new PrintJob();
- if(_loc2_.start())
- {
- bMode0.visible = bMode1.visible = bMode2.visible = bHideFirstLine.visible = bPrint.visible = false;
- if(_loc2_.orientation == PrintJobOrientation.PORTRAIT)
- {
- rotation = 90;
- _falseScaleX = _loc2_.paperHeight / windowWidth;
- _falseScaleY = _loc2_.paperWidth / windowHeight;
- }
- else
- {
- rotation = 0;
- _falseScaleX = _loc2_.paperWidth / windowWidth;
- _falseScaleY = _loc2_.paperHeight / windowHeight;
- }
- redrawAll();
- _loc3_ = new Rectangle(0,0,windowWidth,windowHeight);
- _loc2_.addPage(this,_loc3_);
- _loc2_.send();
- }
- rotation = 0;
- _falseScaleX = _falseScaleY = 1;
- bMode0.visible = bMode1.visible = bMode2.visible = bHideFirstLine.visible = bPrint.visible = true;
- redrawAll();
- }
-
- public function get windowWidth() : Number
- {
- return stage.stageWidth * _falseScaleX;
- }
-
- public function toggleFirstLine(param1:Event = null) : void
- {
- firstLineHidden = !firstLineHidden;
- }
-
- public function redrawGrid() : void
- {
- var _loc1_:uint = 0;
- var _loc2_:Number = NaN;
- var _loc3_:Number = NaN;
- var _loc4_:uint = 0;
- var _loc5_:uint = 0;
- var _loc6_:Number = NaN;
- var _loc7_:Number = NaN;
- var _loc8_:Number = NaN;
- var _loc9_:Number = NaN;
- var _loc10_:TransitionGraphic = null;
- _loc2_ = _currentDrawMode == 0 ? 4 : (_currentDrawMode == 1 ? 6 : 8);
- _loc3_ = 0;
- _loc4_ = 0;
- _loc5_ = 0;
- _loc1_ = 0;
- while(_loc1_ < _transitionTypes.length)
- {
- if(_transitionTypes[_loc1_].drawMode <= _currentDrawMode)
- {
- if(_loc5_ == 0)
- {
- _loc3_++;
- }
- if(++_loc5_ >= _loc2_ || Boolean(_transitionTypes[_loc1_].lineFeed))
- {
- _loc5_ = 0;
- }
- }
- _loc1_++;
- }
- if(_firstLineHidden)
- {
- _loc3_--;
- }
- _loc5_ = 0;
- _loc6_ = MARGIN_LEFT;
- _loc7_ = MARGIN_TOP;
- _loc8_ = (windowWidth - MARGIN_LEFT - MARGIN_RIGHT - _loc2_ * MARGIN_HORIZONTAL) / _loc2_;
- _loc9_ = (windowHeight - MARGIN_TOP - MARGIN_BOTTOM - (_loc3_ - 1) * MARGIN_VERTICAL) / _loc3_;
- _loc1_ = 0;
- while(_loc1_ < _transitionTypes.length)
- {
- _loc10_ = _transitionTypes[_loc1_].container;
- if(_transitionTypes[_loc1_].drawMode <= _currentDrawMode && !(_firstLineHidden && _transitionTypes[_loc1_].lineFeed))
- {
- _loc10_.visible = true;
- _loc10_.setSize(_loc8_,_loc9_);
- _loc10_.x = _loc6_;
- _loc10_.y = _loc7_;
- _loc5_++;
- _loc6_ += _loc8_ + MARGIN_HORIZONTAL;
- if(_loc1_ == 0)
- {
- descriptionMessage.visible = true;
- descriptionMessage.x = _loc6_;
- descriptionMessage.y = _loc7_;
- descriptionMessage.setSize(windowWidth - _loc6_ - MARGIN_RIGHT,_loc9_);
- }
- if(_loc5_ == _loc2_ / 2)
- {
- _loc6_ += MARGIN_HORIZONTAL;
- }
- if(_loc5_ >= _loc2_ || Boolean(_transitionTypes[_loc1_].lineFeed))
- {
- _loc5_ = 0;
- _loc4_++;
- _loc6_ = MARGIN_LEFT;
- _loc7_ += _loc9_ + MARGIN_VERTICAL;
- }
- }
- else
- {
- _loc10_.visible = false;
- if(_loc1_ == 0)
- {
- descriptionMessage.visible = false;
- }
- }
- _loc1_++;
- }
- }
- }
- }
-
-